package com.hsource.doctorcenter.util;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author yangYang
 * @version 1.0
 * @date 2020/9/23 16:58
 * @describe 价格处理工具类
 */
@Slf4j
@Component
public class PriceProcessingUtil {

    /**
     * 获取浮动比例
     * @return
     */
    public static String getPriceRatio(){
        return StaticValue.PRICE_RATIO;
    }
    /**
     * 价格浮动处理
     * @param price 原始价格
     * @return
     */
    public static long priceFloat(long price){
        long v = (long) (price * Double.parseDouble(StaticValue.PRICE_RATIO))/100;
        return v<0?0:v;
    }
    /**
     * 价格浮动处理
     * @param price 原始价格
     * @return
     */
    public static long priceFloatYuan(long price){
        long v = (long) (price * Double.parseDouble(StaticValue.PRICE_RATIO));
        return v<0?0:v;
    }
}
